﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="MemoryStatus.aspx.cs" Inherits="System_MemoryStatus" Title="Memory status" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        td.item
        {
            background-color: #EFF3FB;
        }
        td.item2
        {
            background-color: White;
            color: #284775;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="Server">
    <div style="width: 50%; float: left; height:100px">
        <asp:Label ID="labPhysMemory" runat="server" BackColor="#5D7B9D"
            Width="100%" Font-Bold="True">Physical Memory</asp:Label>
        <asp:Panel ID="panPhysMemory" runat="server" ForeColor="White" BorderColor="#666666"
            BorderStyle="Solid" BorderWidth="1px">
            <table style="width: 100%">
                <tr>
                    <td>
                        Total
                    </td>
                    <td>
                        <%=Others.FormatSize(Memory.TotalPhysical) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        Available
                    </td>
                    <td>
                        <%=Others.FormatSize(Memory.AvailablePhysical) %>(<%=PhysProcentage%>%)
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="background-color: Green">
                        <%imgPhysProcentage.Width = new Unit(PhysProcentage, UnitType.Percentage); %>
                        <asp:Image ID="imgPhysProcentage" runat="server" ImageUrl="~/Images/Bar.JPG" Height="10px"
                            ToolTip="Available physical memory" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
    <div style="width: 50%; float: right; height:100px">
        <asp:Label ID="labPageFile" runat="server" BackColor="#5D7B9D"
            Width="100%" Font-Bold="True">Page File</asp:Label>
        <asp:Panel ID="panPageFile" runat="server" ForeColor="White" BorderColor="#666666"
            BorderStyle="Solid" BorderWidth="1px">
            <table style="width: 100%">
                <tr>
                    <td>
                        Total
                    </td>
                    <td>
                        <%=Others.FormatSize(Memory.TotalPageFile) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        Available
                    </td>
                    <td>
                        <%=Others.FormatSize(Memory.AvailablePageFile) %>(<%=PageFileProcentage%>%)
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="background-color: Green">
                        <%imgPageFileProcentage.Width = new Unit(PageFileProcentage, UnitType.Percentage); %>
                        <asp:Image ID="imgPageFileProcentage" runat="server" ImageUrl="~/Images/Bar.JPG"
                            Height="10px" ToolTip="Available page file memory" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </div>
    
    <div style="padding-top:15px">
        <asp:ListView ID="lvProcesses" runat="server">
            <LayoutTemplate>
                <table style="width: 100%" cellspacing="0">
                    <caption style="background-color: #5D7B9D; font-weight: bold">
                        Processes with highest memory usage
                    </caption>
                    <thead>
                        <tr style="text-align: left; background-color: #5D7B9D">
                            <th>
                                Name
                            </th>
                            <th>
                                Terminal session ID
                            </th>
                            <th>
                                Memory usage
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr id="itemPlaceholder" runat="server" />
                    </tbody>
                </table>
            </LayoutTemplate>
            <ItemTemplate>
                <tr>
                    <td class="item">
                        <%#Eval("Name") %>
                    </td>
                    <td class="item">
                        <%#Eval("Session")%>
                    </td>
                    <td class="item">
                        <%#Eval("WorkingSet") %>
                    </td>
                </tr>
            </ItemTemplate>
            <AlternatingItemTemplate>
                <tr>
                    <td class="item2">
                        <%#Eval("Name") %>
                    </td>
                    <td class="item2">
                        <%#Eval("Session")%>                        
                    </td>
                    <td class="item2">
                        <%#Eval("WorkingSet") %>
                    </td>
                </tr>
            </AlternatingItemTemplate>
        </asp:ListView>
    </div>
    
    <cc1:CollapsiblePanelExtender ID="collPhysMemory" runat="server" TargetControlID="panPhysMemory"
        CollapseControlID="labPhysMemory" ExpandControlID="labPhysMemory" Collapsed="false"
        AutoExpand="True" />
    <cc1:CollapsiblePanelExtender ID="collPageFile" runat="server" TargetControlID="panPageFile"
        CollapseControlID="labPageFile" ExpandControlID="labPageFile" Collapsed="false"
        AutoExpand="True" />
</asp:Content>
